package com.cobra.rdd.operator.transform

import org.apache.spark.{SparkConf, SparkContext}

//将每个分区形成一个数组
object Spark08_RDD_Operator_Transform_glom {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("mapPartitionsWithIndex")
    val sc = new SparkContext(sparkConf)
    val rdd = sc.makeRDD(List(1, 2, 3, 4),2)
    val glomRDD = rdd.glom()

    glomRDD.collect().foreach(data=>println(data.mkString(",")))
    sc.stop()
  }
}
